import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
    import news from '@/views/modules/news/list'
    import aboutus from '@/views/modules/aboutus/list'
    import xuesheng from '@/views/modules/xuesheng/list'
    import fenzu from '@/views/modules/fenzu/list'
    import xueshengbaomingxinxi from '@/views/modules/xueshengbaomingxinxi/list'
    import xueshengyundongxiangmu from '@/views/modules/xueshengyundongxiangmu/list'
    import jiaoshi from '@/views/modules/jiaoshi/list'
    import caipanyuan from '@/views/modules/caipanyuan/list'
    import changci from '@/views/modules/changci/list'
    import xueshengsaichenganpai from '@/views/modules/xueshengsaichenganpai/list'
    import yundongmingcheng from '@/views/modules/yundongmingcheng/list'
    import jiaoshiyundongxiangmu from '@/views/modules/jiaoshiyundongxiangmu/list'
    import jiaoshibaomingxinxi from '@/views/modules/jiaoshibaomingxinxi/list'
    import jiaoshisaichenganpai from '@/views/modules/jiaoshisaichenganpai/list'
    import systemintro from '@/views/modules/systemintro/list'
    import xueshengyundongchengji from '@/views/modules/xueshengyundongchengji/list'
    import discussxueshengyundongxiangmu from '@/views/modules/discussxueshengyundongxiangmu/list'
    import jiaoshiyundongchengji from '@/views/modules/jiaoshiyundongchengji/list'
    import discussjiaoshiyundongxiangmu from '@/views/modules/discussjiaoshiyundongxiangmu/list'
    import config from '@/views/modules/config/list'
    import newstype from '@/views/modules/newstype/list'


//2.配置路由   注意：名字
export const routes = [{
    path: '/',
    name: '系统首页',
    component: Index,
    children: [{
      // 这里不设置值，是把main作为默认页面
      path: '/',
      name: '系统首页',
      component: Home,
      meta: {icon:'', title:'center', affix: true}
    }, {
      path: '/updatePassword',
      name: '修改密码',
      component: UpdatePassword,
      meta: {icon:'', title:'updatePassword'}
    }, {
      path: '/pay',
      name: '支付',
      component: pay,
      meta: {icon:'', title:'pay'}
    }, {
      path: '/center',
      name: '个人信息',
      component: center,
      meta: {icon:'', title:'center'}
    }
      ,{
	path: '/news',
        name: '通知公告',
        component: news
      }
      ,{
	path: '/aboutus',
        name: '关于我们',
        component: aboutus
      }
      ,{
	path: '/xuesheng',
        name: '学生',
        component: xuesheng
      }
      ,{
	path: '/fenzu',
        name: '分组',
        component: fenzu
      }
      ,{
	path: '/xueshengbaomingxinxi',
        name: '学生报名信息',
        component: xueshengbaomingxinxi
      }
      ,{
	path: '/xueshengyundongxiangmu',
        name: '学生活动项目',
        component: xueshengyundongxiangmu
      }
      ,{
	path: '/jiaoshi',
        name: '教师',
        component: jiaoshi
      }
      ,{
	path: '/caipanyuan',
        name: '主办方',
        component: caipanyuan
      }
      ,{
	path: '/changci',
        name: '场次',
        component: changci
      }
      ,{
	path: '/xueshengsaichenganpai',
        name: '学生赛程安排',
        component: xueshengsaichenganpai
      }
      ,{
	path: '/yundongmingcheng',
        name: '活动类型',
        component: yundongmingcheng
      }
      ,{
	path: '/jiaoshiyundongxiangmu',
        name: '教师活动项目',
        component: jiaoshiyundongxiangmu
      }
      ,{
	path: '/jiaoshibaomingxinxi',
        name: '教师报名信息',
        component: jiaoshibaomingxinxi
      }
      ,{
	path: '/jiaoshisaichenganpai',
        name: '教师赛程安排',
        component: jiaoshisaichenganpai
      }
      ,{
	path: '/systemintro',
        name: '系统简介',
        component: systemintro
      }
      ,{
	path: '/xueshengyundongchengji',
        name: '学生活动成绩',
        component: xueshengyundongchengji
      }
      ,{
	path: '/discussxueshengyundongxiangmu',
        name: '学生活动项目评论',
        component: discussxueshengyundongxiangmu
      }
      ,{
	path: '/jiaoshiyundongchengji',
        name: '教师活动成绩',
        component: jiaoshiyundongchengji
      }
      ,{
	path: '/discussjiaoshiyundongxiangmu',
        name: '教师活动项目评论',
        component: discussjiaoshiyundongxiangmu
      }
      ,{
	path: '/config',
        name: '轮播图管理',
        component: config
      }
      ,{
	path: '/newstype',
        name: '通知公告分类',
        component: newstype
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {icon:'', title:'login'}
  },
  {
    path: '/register',
    name: 'register',
    component: register,
    meta: {icon:'', title:'register'}
  },
  {
    path: '*',
    component: NotFound
  }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: 'hash',
  /*hash模式改为history*/
  routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
export default router;
